Package-level declarations

Types

Link copied to clipboard
data class EntityField(val name: String, val type: EntityFieldType, val sortable: Boolean = false, val filterable: Boolean = false, val enumValues: Set<String> = emptySet())

A field of an entity: its name as exposed to callers, its type, and whether callers may sort or filter on it. enumValues lists the allowed values of an EntityFieldType.ENUM field.

Link copied to clipboard

The data types an EntityField can have.

Link copied to clipboard
sealed interface PatchField<out T>

A property of an update command that tells "not supplied" (Unset) apart from "supplied, possibly as null" (Value).

Link copied to clipboard
data class Sort(val fields: List<SortField>)

An ordered, non-empty list of sort criteria.

Link copied to clipboard

Direction of a SortField.

Link copied to clipboard
data class SortField(val field: EntityField, val direction: SortDirection)

A single sort criterion: a field and the direction to order it in.

Functions

Link copied to clipboard

Sorts by this field ascending.

Link copied to clipboard

Sorts by this field descending.

Link copied to clipboard
fun <T> PatchField<T>.nullAs(replacement: T): PatchField<T>

Returns Value of replacement for Value(null), otherwise this field unchanged.

Link copied to clipboard
fun <T> PatchField<T>.orKeep(current: T?): T?

Returns current for Unset, otherwise the supplied value (even when null).

Link copied to clipboard
fun <T> PatchField<T>.orKeepRequired(current: T, fieldName: String): T

Same as orKeep for a field that must never be null.

Link copied to clipboard

Returns the supplied collection, or null if the group must not be touched (PatchField.Unset).

Link copied to clipboard

Same as toTargetIdsOrNull for elements that already are raw ids.

fun <T, R> PatchField<Collection<T>?>.toTargetIdsOrNull(transform: (T) -> R): Set<R>?

Converts this field to the set of target ids a junction relation must be synced to, or null if the relation must not be touched (PatchField.Unset).